package com.jwdf.uda.http.action;

import android.content.Context;

import com.jwdf.uda.bean.PbBean;
import com.jwdf.uda.http.AHttpService;
import com.jwdf.uda.http.ApiService;
import com.jwdf.uda.utils.ConfigUtils;

import retrofit2.Call;

/**
 * 类说明：
 * 作者：huangqiuxin on 2016/5/12 19:14
 * 邮箱：648859026@qq.com
 */
public class UserInfoAction extends AHttpService<PbBean.PbResUserGetInfo>{

    private String userId;

    private UserInfoAction(Context context,String userId) {
        super(context);
        this.userId=userId;
    }

    private UserInfoAction(Context context) {
        super(context);
        this.userId= ConfigUtils.getUserId(context);
    }

    public static UserInfoAction newInstance(Context context) {
        return new UserInfoAction(context);
    }

    /**
     * 获取用户信息
     *
     * @param context
     *
     * @return
     */
    public static UserInfoAction newInstance(Context context, String userId) {
        return new UserInfoAction(context, userId);
    }

    @Override
    protected Call newRetrofitCall(ApiService apiService, PbBean.PbBaseClientInfo.Builder baseBuilder) {
        PbBean.PbReqUserGetInfo.Builder builder = PbBean.PbReqUserGetInfo.newBuilder();
        builder.setBaseClientInfo(baseBuilder);
        builder.setUserId(userId);

        return apiService.getUserInfo(builder.build());
    }
}
